//
//  newsFlashTableViewCell.m
//  Cars' home
//
//  Created by dapeng on 15/11/30.
//  Copyright © 2015年 dapeng. All rights reserved.
//

#import "newsFlashTableViewCell.h"
#import "Theme-PrefixHeader.pch"
@implementation newsFlashTableViewCell
- (void)dealloc {
    [_imageViews release];
    [_timeLabel release];
    [_reviewLabel release];
    [_titleLabel release];
    [_typeNameLabel release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViews = [[UIImageView alloc] init];
        self.timeLabel = [[UILabel alloc] init];
        self.titleLabel = [[UILabel alloc] init];
        self.reviewLabel = [[UILabel alloc] init];
        self.typeNameLabel = [[UILabel alloc] init];
        self.playEndLabel = [[UILabel alloc] init];
        [_imageViews release];
        [_timeLabel release];
        [_titleLabel release];
        [_reviewLabel release];
        [_typeNameLabel release];
        [_playEndLabel release];
        [self addSubview:self.imageViews];
        [self addSubview:self.timeLabel];
        [self addSubview:self.titleLabel];
        [self addSubview:self.reviewLabel];
        [self addSubview:self.typeNameLabel];
        [self addSubview:self.playEndLabel];
        [_imageViews release];
        [_timeLabel release];
        [_titleLabel release];
        [_reviewLabel release];
        [_typeNameLabel release];
        [_playEndLabel release];
        self.backgroundColor = [[ConfigurationTheme shareInstance] getThemeColorWithName:@"ygColor"];
      
    }return self;
}


- (void)layoutSubviews {
    [super layoutSubviews];
    self.typeNameLabel.frame = CGRectMake(20, 20, 100, 10);
    self.playEndLabel.frame = CGRectMake(SCREEN_SIZE.width - 65, 20, 50, 13);
    self.titleLabel.frame = CGRectMake(20, 40, SCREEN_SIZE.width - 100, 20);
    self.imageViews.frame = CGRectMake(20, 60, SCREEN_SIZE.width - 40, SCREEN_SIZE.height / 3.5);
    
    self.reviewLabel.frame = CGRectMake(SCREEN_SIZE.width - 100, 40, 100, 20);
    self.timeLabel.frame = CGRectMake(20, SCREEN_SIZE.height / 3.5 + 60, 100, 20);
}

- (void)setTwoModel2:(flashTwoModel *)twoModel2 {
    if (_twoModel2 != twoModel2) {
        [_twoModel2 release];
        _twoModel2 = [twoModel2 retain];
        
    }
    [self.imageViews sd_setImageWithURL:[NSURL URLWithString:twoModel2.img] placeholderImage:[UIImage imageNamed:@"zhanwei"]];
    self.titleLabel.text = twoModel2.title;
    self.reviewLabel.text = [NSString stringWithFormat:@"%@位观众", twoModel2.reviewcount];
    self.timeLabel.text = twoModel2.createtime;
    self.typeNameLabel.text = twoModel2.typenames;
    self.playEndLabel.text = @"播报结束";
    
    self.reviewLabel.font = [UIFont systemFontOfSize:13];
    self.timeLabel.font = [UIFont systemFontOfSize:13];
    self.typeNameLabel.font = [UIFont systemFontOfSize:13];
    self.playEndLabel.font = [UIFont systemFontOfSize:12];
    self.typeNameLabel.textColor = [UIColor blueColor];
    self.playEndLabel.backgroundColor = [UIColor grayColor];
    
    self.reviewLabel.alpha = 0.5;
    self.timeLabel.alpha = 0.5;
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString *passWord = [user objectForKey:@"nightModel"];
    
    if (!(passWord == nil) && [passWord isEqualToString:@"day"]) {
        self.backgroundColor = [UIColor colorWithWhite:0.126 alpha:1.000];
        self.titleLabel.textColor = RGB(153.0,153.0,153.0,1.0f);
        
    }else{
        self.backgroundColor = [UIColor whiteColor];
        
    }
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
